package com.atguigu.domain;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 在购物车页面显示的行item
 */
public class BookItems  implements Serializable {

    /**
     * 页面显示的book对象
     */
    private Book book;

    private Integer id;

    private String name;

    private int count;

    private BigDecimal price;

    private BigDecimal totalMoney;

    public Integer getId() {
        return book.getId();
    }

    public BookItems(Book book, int count) {
        this.book = book;
        this.count = count;
    }

    public Book getBook() {
        return book;
    }

    public String getName() {
        return book.getName();
    }


    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public BigDecimal getPrice() {
        return book.getPrice();
    }

    public BigDecimal getTotalMoney() {
        BigDecimal totalMoney = getPrice().multiply(new BigDecimal(String.valueOf(getCount())));
        return totalMoney;
    }

}
